import { createBrowserRouter } from "react-router-dom"

// 一级路由 - 登录
import Login from '@/pages/Login'
// 一级路由 - 主页
import Layout from '@/pages/Layout'

// 二级路由 - 首页
import Home from "@/pages/Home"
// 二级路由 - 文章
import Article from "@/pages/Article"
// 二级路由 - 创建文章
import Publish from "@/pages/Publish"

import { AuthRoute } from "@/components/AuthRoute"

const router = createBrowserRouter([
    {
        path: '/', element: <AuthRoute><Layout /></AuthRoute>,
        children: [
            {
                index: true,
                element: <Home />,
            },
            {
                path: 'article',
                element: <Article />,
            },
            {
                path: 'publish',
                element: <Publish />,
            },
        ]
    },
    { path: '/login', element: <Login /> },
])

export default router